home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / Delphi 3.0 / DATA.Z / OUTLIMPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-30  |  9.1 KB  |  369 lines

  1. unit OutlImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelLib, Grids, Outline;
  8.  
  9. type
  10.   TOutlineX = class(TActiveXControl, IOutlineX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TOutline;
  14.     FEvents: IOutlineXEvents;
  15.     procedure ClickEvent(Sender: TObject);
  16.     procedure CollapseEvent(Sender: TObject; Index: Integer);
  17.     procedure DblClickEvent(Sender: TObject);
  18.     procedure ExpandEvent(Sender: TObject; Index: Integer);
  19.     procedure KeyPressEvent(Sender: TObject; var Key: Char);
  20.   protected
  21.     { Protected declarations }
  22.     procedure InitializeControl; override;
  23.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  24.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  25.     function Add(Index: Integer; const Text: WideString): Integer; safecall;
  26.     function AddChild(Index: Integer; const Text: WideString): Integer;
  27.       safecall;
  28.     function Get_Color: TColor; safecall;
  29.     function Get_Ctl3D: WordBool; safecall;
  30.     function Get_Cursor: Smallint; safecall;
  31.     function Get_DragCursor: Smallint; safecall;
  32.     function Get_Enabled: WordBool; safecall;
  33.     function Get_Font: Font; safecall;
  34.     function Get_ItemCount: Integer; safecall;
  35.     function Get_ItemHeight: Integer; safecall;
  36.     function Get_ItemSeparator: WideString; safecall;
  37.     function Get_Lines: IStrings; safecall;
  38.     function Get_OutlineStyle: TxOutlineStyle; safecall;
  39.     function Get_ParentColor: WordBool; safecall;
  40.     function Get_Row: Integer; safecall;
  41.     function Get_SelectedItem: Integer; safecall;
  42.     function Get_Style: TxOutlineType; safecall;
  43.     function Get_Visible: WordBool; safecall;
  44.     function GetItem(X, Y: Integer): Integer; safecall;
  45.     function GetTextItem(const Value: WideString): Integer; safecall;
  46.     function Insert(Index: Integer; const Text: WideString): Integer; safecall;
  47.     procedure AboutBox; safecall;
  48.     procedure BeginUpdate; safecall;
  49.     procedure Clear; safecall;
  50.     procedure Delete(Index: Integer); safecall;
  51.     procedure EndUpdate; safecall;
  52.     procedure FullCollapse; safecall;
  53.     procedure FullExpand; safecall;
  54.     procedure LoadFromFile(const FileName: WideString); safecall;
  55.     procedure SaveToFile(const FileName: WideString); safecall;
  56.     procedure Set_Color(Value: TColor); safecall;
  57.     procedure Set_Ctl3D(Value: WordBool); safecall;
  58.     procedure Set_Cursor(Value: Smallint); safecall;
  59.     procedure Set_DragCursor(Value: Smallint); safecall;
  60.     procedure Set_Enabled(Value: WordBool); safecall;
  61.     procedure Set_Font(const Value: Font); safecall;
  62.     procedure Set_ItemHeight(Value: Integer); safecall;
  63.     procedure Set_ItemSeparator(const Value: WideString); safecall;
  64.     procedure Set_Lines(const Value: IStrings); safecall;
  65.     procedure Set_OutlineStyle(Value: TxOutlineStyle); safecall;
  66.     procedure Set_ParentColor(Value: WordBool); safecall;
  67.     procedure Set_Row(Value: Integer); safecall;
  68.     procedure Set_SelectedItem(Value: Integer); safecall;
  69.     procedure Set_Style(Value: TxOutlineType); safecall;
  70.     procedure Set_Visible(Value: WordBool); safecall;
  71.     procedure SetUpdateState(Value: WordBool); safecall;
  72.   end;
  73.  
  74. implementation
  75. uses OutLnPg;
  76. { TOutlineX }
  77.  
  78. procedure TOutlineX.InitializeControl;
  79. begin
  80.   FDelphiControl := Control as TOutline;
  81.   FDelphiControl.OnClick := ClickEvent;
  82.   FDelphiControl.OnCollapse := CollapseEvent;
  83.   FDelphiControl.OnDblClick := DblClickEvent;
  84.   FDelphiControl.OnExpand := ExpandEvent;
  85.   FDelphiControl.OnKeyPress := KeyPressEvent;
  86. end;
  87.  
  88. procedure TOutlineX.EventSinkChanged(const EventSink: IUnknown);
  89. begin
  90.   FEvents := EventSink as IOutlineXEvents;
  91. end;
  92.  
  93. procedure TOutlineX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  94. begin
  95.   { Define property pages here.  Property pages are defined by calling
  96.     DefinePropertyPage with the class id of the page.  For example,
  97.       DefinePropertyPage(Class_OutlineXPage); }
  98. end;
  99.  
  100. function TOutlineX.Add(Index: Integer; const Text: WideString): Integer;
  101. begin
  102.  
  103. end;
  104.  
  105. function TOutlineX.AddChild(Index: Integer;
  106.   const Text: WideString): Integer;
  107. begin
  108.  
  109. end;
  110.  
  111. function TOutlineX.Get_Color: TColor;
  112. begin
  113.   Result := FDelphiControl.Color;
  114. end;
  115.  
  116. function TOutlineX.Get_Ctl3D: WordBool;
  117. begin
  118.   Result := FDelphiControl.Ctl3D;
  119. end;
  120.  
  121. function TOutlineX.Get_Cursor: Smallint;
  122. begin
  123.   Result := Smallint(FDelphiControl.Cursor);
  124. end;
  125.  
  126. function TOutlineX.Get_DragCursor: Smallint;
  127. begin
  128.   Result := Smallint(FDelphiControl.DragCursor);
  129. end;
  130.  
  131. function TOutlineX.Get_Enabled: WordBool;
  132. begin
  133.   Result := FDelphiControl.Enabled;
  134. end;
  135.  
  136. function TOutlineX.Get_Font: Font;
  137. begin
  138.   GetOleFont(FDelphiControl.Font, Result);
  139. end;
  140.  
  141. function TOutlineX.Get_ItemCount: Integer;
  142. begin
  143.   Result := FDelphiControl.ItemCount;
  144. end;
  145.  
  146. function TOutlineX.Get_ItemHeight: Integer;
  147. begin
  148.   Result := FDelphiControl.ItemHeight;
  149. end;
  150.  
  151. function TOutlineX.Get_ItemSeparator: WideString;
  152. begin
  153.   Result := WideString(FDelphiControl.ItemSeparator);
  154. end;
  155.  
  156. function TOutlineX.Get_Lines: IStrings;
  157. begin
  158.   GetOleStrings(FDelphiControl.Lines, Result);
  159. end;
  160.  
  161. function TOutlineX.Get_OutlineStyle: TxOutlineStyle;
  162. begin
  163.   Result := Ord(FDelphiControl.OutlineStyle);
  164. end;
  165.  
  166. function TOutlineX.Get_ParentColor: WordBool;
  167. begin
  168.   Result := FDelphiControl.ParentColor;
  169. end;
  170.  
  171. function TOutlineX.Get_Row: Integer;
  172. begin
  173.   Result := FDelphiControl.Row;
  174. end;
  175.  
  176. function TOutlineX.Get_SelectedItem: Integer;
  177. begin
  178.   Result := FDelphiControl.SelectedItem;
  179. end;
  180.  
  181. function TOutlineX.Get_Style: TxOutlineType;
  182. begin
  183.   Result := Ord(FDelphiControl.Style);
  184. end;
  185.  
  186. function TOutlineX.Get_Visible: WordBool;
  187. begin
  188.   Result := FDelphiControl.Visible;
  189. end;
  190.  
  191. function TOutlineX.GetItem(X, Y: Integer): Integer;
  192. begin
  193.  
  194. end;
  195.  
  196. function TOutlineX.GetTextItem(const Value: WideString): Integer;
  197. begin
  198.  
  199. end;
  200.  
  201. function TOutlineX.Insert(Index: Integer; const Text: WideString): Integer;
  202. begin
  203.  
  204. end;
  205.  
  206. procedure TOutlineX.AboutBox;
  207. begin
  208.   ShowOutlineXAbout;
  209. end;
  210.  
  211. procedure TOutlineX.BeginUpdate;
  212. begin
  213.  
  214. end;
  215.  
  216. procedure TOutlineX.Clear;
  217. begin
  218.  
  219. end;
  220.  
  221. procedure TOutlineX.Delete(Index: Integer);
  222. begin
  223.  
  224. end;
  225.  
  226. procedure TOutlineX.EndUpdate;
  227. begin
  228.  
  229. end;
  230.  
  231. procedure TOutlineX.FullCollapse;
  232. begin
  233.  
  234. end;
  235.  
  236. procedure TOutlineX.FullExpand;
  237. begin
  238.  
  239. end;
  240.  
  241. procedure TOutlineX.LoadFromFile(const FileName: WideString);
  242. begin
  243.  
  244. end;
  245.  
  246. procedure TOutlineX.SaveToFile(const FileName: WideString);
  247. begin
  248.  
  249. end;
  250.  
  251. procedure TOutlineX.Set_Color(Value: TColor);
  252. begin
  253.   FDelphiControl.Color := Value;
  254. end;
  255.  
  256. procedure TOutlineX.Set_Ctl3D(Value: WordBool);
  257. begin
  258.   FDelphiControl.Ctl3D := Value;
  259. end;
  260.  
  261. procedure TOutlineX.Set_Cursor(Value: Smallint);
  262. begin
  263.   FDelphiControl.Cursor := TCursor(Value);
  264. end;
  265.  
  266. procedure TOutlineX.Set_DragCursor(Value: Smallint);
  267. begin
  268.   FDelphiControl.DragCursor := TCursor(Value);
  269. end;
  270.  
  271. procedure TOutlineX.Set_Enabled(Value: WordBool);
  272. begin
  273.   FDelphiControl.Enabled := Value;
  274. end;
  275.  
  276. procedure TOutlineX.Set_Font(const Value: Font);
  277. begin
  278.   SetOleFont(FDelphiControl.Font, Value);
  279. end;
  280.  
  281. procedure TOutlineX.Set_ItemHeight(Value: Integer);
  282. begin
  283.   FDelphiControl.ItemHeight := Value;
  284. end;
  285.  
  286. procedure TOutlineX.Set_ItemSeparator(const Value: WideString);
  287. begin
  288.   FDelphiControl.ItemSeparator := String(Value);
  289. end;
  290.  
  291. procedure TOutlineX.Set_Lines(const Value: IStrings);
  292. begin
  293.   SetOleStrings(FDelphiControl.Lines, Value);
  294. end;
  295.  
  296. procedure TOutlineX.Set_OutlineStyle(Value: TxOutlineStyle);
  297. begin
  298.   FDelphiControl.OutlineStyle := TOutlineStyle(Value);
  299. end;
  300.  
  301. procedure TOutlineX.Set_ParentColor(Value: WordBool);
  302. begin
  303.   FDelphiControl.ParentColor := Value;
  304. end;
  305.  
  306. procedure TOutlineX.Set_Row(Value: Integer);
  307. begin
  308.   FDelphiControl.Row := Value;
  309. end;
  310.  
  311. procedure TOutlineX.Set_SelectedItem(Value: Integer);
  312. begin
  313.   FDelphiControl.SelectedItem := Value;
  314. end;
  315.  
  316. procedure TOutlineX.Set_Style(Value: TxOutlineType);
  317. begin
  318.   FDelphiControl.Style := TOutlineType(Value);
  319. end;
  320.  
  321. procedure TOutlineX.Set_Visible(Value: WordBool);
  322. begin
  323.   FDelphiControl.Visible := Value;
  324. end;
  325.  
  326. procedure TOutlineX.SetUpdateState(Value: WordBool);
  327. begin
  328.  
  329. end;
  330.  
  331. procedure TOutlineX.ClickEvent(Sender: TObject);
  332. begin
  333.   if FEvents <> nil then FEvents.OnClick;
  334. end;
  335.  
  336. procedure TOutlineX.CollapseEvent(Sender: TObject; Index: Integer);
  337. begin
  338.   if FEvents <> nil then FEvents.OnCollapse(Index);
  339. end;
  340.  
  341. procedure TOutlineX.DblClickEvent(Sender: TObject);
  342. begin
  343.   if FEvents <> nil then FEvents.OnDblClick;
  344. end;
  345.  
  346. procedure TOutlineX.ExpandEvent(Sender: TObject; Index: Integer);
  347. begin
  348.   if FEvents <> nil then FEvents.OnExpand(Index);
  349. end;
  350.  
  351. procedure TOutlineX.KeyPressEvent(Sender: TObject; var Key: Char);
  352. var
  353.   TempKey: Smallint;
  354. begin
  355.   TempKey := Smallint(Key);
  356.   if FEvents <> nil then FEvents.OnKeyPress(TempKey);
  357.   Key := Char(TempKey);
  358. end;
  359.  
  360. initialization
  361.   TActiveXControlFactory.Create(
  362.     ComServer,
  363.     TOutlineX,
  364.     TOutline,
  365.     Class_OutlineX,
  366.     15,
  367.     '{5A5659A5-7975-11D0-BE02-00A024D1875C}');
  368. end.
  369.